import { Application } from 'egg';
module.exports = (app: Application) => {
  const { STRING, INTEGER, DATE } = app.Sequelize;

  const SysMember = app.model.define('sys_member', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    name: STRING(256),
    user_name: {
      type: STRING(256),
      unique: true,
      comment: '用户名',
    },
    password: {
      type: STRING(256),
      comment: '密码',
    },
    email: {
      type: STRING(256),
      comment: '邮箱',
    },
    mobile: {
      type: INTEGER,
      comment: '手机号',
    },
    avatar: {
      type: STRING(1024),
      comment: '头像',
    },
    role: {
      type: INTEGER,
      comment: '所属角色',
    },
    status: {
      type: INTEGER,
      defaultValue: 1,
      comment: '状态',
    },
    created_at: DATE,
    updated_at: DATE,
  },
  {
    freezeTableName: true,
    tableName: 'sys_member',
  });
  return SysMember;
};